package czh.cocoa.sample;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import czh.cocoa.foundation.NSObject;
import czh.cocoa.foundation.NSSet;
import czh.cocoa.foundation.NSString;
import czh.cocoa.graphics.CGBlendMode;
import czh.cocoa.graphics.CGColor;
import czh.cocoa.graphics.CGContext;
import czh.cocoa.graphics.CGFont;
import czh.cocoa.graphics.CGGradient;
import czh.cocoa.graphics.CGImage;
import czh.cocoa.graphics.CGPath;
import czh.cocoa.graphics.CGPoint;
import czh.cocoa.graphics.CGRect;
import czh.cocoa.graphics.CGSize;
import czh.cocoa.ui.UIColor;
import czh.cocoa.ui.UIEvent;
import czh.cocoa.ui.UIFont;
import czh.cocoa.ui.UIImage;
import czh.cocoa.ui.UILineBreakMode;
import czh.cocoa.ui.UITouch;
import czh.cocoa.ui.UIView;

import static czh.cocoa.ui.UIKit.*;
import static czh.cocoa.graphics.CGContext.*;

public class MyView extends UIView {

	private UIColor mColor;
	
	private UIImage mImage;
	
	private UIImage mOverlay;
	
	public MyView() {
		super();
		mImage = UIImage.imageNamed(NSTR("prop_6"));  
	}
	
	public MyView(CGRect frame) {
		super(frame);
		mImage = UIImage.imageNamed(NSTR("prop_6"));
	}

	public void drawRect(CGRect rect) {
		
		
		mImage.drawInRect(rect);
		
		CGContext ctx = UIGraphicsGetCurrentContext();
		
		CGContextSetBlendMode(ctx, CGBlendMode.DestinationAtop);  
		
		
		
		mOverlay.drawInRect(rect);
		
		
		//CGContextFillRect(ctx, rect);
		CGContextSetBlendMode(ctx, null);
	}
	
	public void setColor(UIColor color) {
		mColor = color;
		setNeedsDisplay();
	}

	
}
